<?php

namespace Model;

//Klass för skapande & hämtning av array innehållande post-objekt
class PostArray 
{
        private $posts = array();
                     
        public function Add(Post $post)
		{
                $this->posts[] = $post; 
        }
        
        public function Get() 
        {
                return $this->posts;
        }
		
        public function Count() 
        {
                return count($this->posts);
        }		
}

//Klass för konsruering av post-objekt.
class Post
{
        private $postId; //Int
        private $topicId;//Int
        private $userId;//Int		
        private $topicHeader; //String
        private $userName; //String
        private $date; //Date
        private $content; //String
        
        //Konstruktor
        public function __construct($postId, $topicId, $userId, $topicHeader, $userName, $date, $content)
		{
                $this->postId = $postId;
				$this->topicId = $topicId;
				$this->userId = $userId;
                $this->topicHeader = $topicHeader;
                $this->userName = $userName;
				$this->date = $date;
				$this->content = $content;
        }
        
		//Publika funktioner som returnerar objektets delar separat
		
        public function GetId() 
        {
                return $this->postId;
        }

        public function GetTopicId() 
        {
                return $this->topicId;
        }

        public function GetUserId() 
        {
                return $this->userId;
        }

        public function GetTopicHeader()
		{
                return $this->topicHeader;
        }              
        public function GetDate() 
        {
                return $this->date;                         
        }
		
		public function GetUserName()
		{
				return $this->userName;
		}
		
		public function GetContent()
		{
				return $this->content;
		}				
}